#coding=utf8

import socket

host = '192.168.21.78'
port = 12345
buf_size = 1024
addr = (host,port)

while True:
	cl_sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
	cl_sock.connect(addr)
	data = raw_input('>')
	if not data:
		break
	cl_sock.send('%s\r\n%s\r\n'%(data,data+'nima'))
	data = cl_sock.recv(buf_size)
	if not data:
		print('socket error')
		break
	print 'receive data'
	print data.strip()
	cl_sock.close()
